/*--------------------------------------------------*/
/* Modelisateur objet d'un simulateur de robot		*/
/* Camille Roux										*/
/* Matthieu Segret									*/
/*--------------------------------------------------*/

#include <iostream>
#include "CommandLine.h"
#include "Commande.h"
#include "MauvaisEtat.h"
#include "MauvaiseCommande.h"

using namespace std;


void CommandLine::launcher()
{		
		
	cout << "*** Simulation Robot ***"<< endl;
	string entree;
	//Commande* commande;
	
	while(true)
	{
		try
		{
			cout << ">";
			cin >> entree;
			Commande::CreerCommande(entree)->executer(this);
		}
		catch(MauvaisEtat &e)
		{
			cout << e.geterreur() << endl;
		}
		catch(MauvaiseCommande &e)
		{
			cout << e.geterreur() << endl;
		}
	}

	cout << "*** Fin de la Simulation ***"<< endl;
}


std::string CommandLine::getParametre()
{
	std::string parametre;
	cin >> 	parametre;
	return parametre;
}
